/**
 * @author Matan Mizrahi,Chen weissman
 * Introduction to computer science, assingment5
 * Date:2.1.2011
 *
 * A class which objects represent mathematical expressions.
 *
 */
public interface Expression
{

	/**
	 * 
	 * Evaluates the expression given an assignment. 
	 * @param assign the given assignment.
	 * @return The value of this expression with respect
	 * to the given assignment. Any variable in the expression 
	 * which is not assigned with a value under the assignment
	 * {@code assign} will be considered as a variable which
	 * value is 0.
	 * @throws Exception  in case the assignment is null or if the variable is not assigned to a value
	 */
	public double evaluate(Assignment assign) throws Exception;
	
	/**
	 * 
	 * Derivative operation on Expression according to varName.
	 * @param varName the name of the variable according to which
	 * the expression is derived.
	 * @return New expression representing the derivative of this expression.
	 */
	public Expression derivative(char varName);
	
	/**
	 * Replicating the invoking object.
	 * 
	 * @return a replicate of this object. The returned object has
	 * to be a new object (with a different address than this
	 * object), but equivalent to the this object under the 
	 * application of the {@code equals(Object other)} method.
	 */
	public Expression replicate(); 

}
